﻿using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using SXFramWork.Core;
using SXFramWork.Service;

namespace SXFramWork.API.Controllers.Admin
{
    /// <summary>
    /// 错误日志
    /// </summary>
    public class SysErrorLogController : WebController
    {
        private readonly ISysLogService _service;
        private readonly IWebHostEnvironment _env;
        public SysErrorLogController(ISysLogService sysLogService, IWebHostEnvironment webHostEnvironment)
        {
            _env = webHostEnvironment;
            _service = sysLogService;
        }
        /// <summary>
        /// 查询错误日志文件
        /// </summary>
        /// <param name="parm"></param>
        /// <returns></returns>
        [HttpGet]
        [Menu("错误日志","/admin/errorlog")]
        public async Task<IApiResult> GetErrorLog()
        {
            return await _service.GetErrorLog(_env.ContentRootPath);

        }

    }
}